<template>
  <component
    :is="compName"
    v-bind="$attrs"
    v-on="$attrs"
  >
    <slot></slot>
  </component>
</template>
<script>
import Complex from './complex'
import Simple from './simple'
import Adapter from './adapter'
import { oneOf } from '../../utils/assist'
export default {
  inheritAttrs: false,
  props: {
    type: {
      validator (value) {
        return oneOf(value, ['simple', 'complex', 'adaptive'])
      },
      default: 'adaptive'
    }
  },
  components: {
    Complex,
    Simple,
    Adapter
  },
  computed: {
    compName () {
      return this.type === 'complex' ? 'Complex' : this.type === 'simple' ? 'Simple' : 'Adapter'
    }
  }
}
</script>
